﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebmasterTool/Admin.Master" AutoEventWireup="true"
    CodeBehind="WebLink.aspx.cs" Inherits="Framework.WebmasterTool.WebLink" %>

<%@ Register Src="../Controls/simpleImageUploadUserControl/SimpleImageUpload.ascx" TagName="SimpleImageUpload"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%= btnDelete.ClientID %>").live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                            function (r) {
                                if (r) {
                                    __doPostBack(callFrom.attr('name').replace(/_/g, '$'), '');
                                }
                            });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctlCaption" runat="Server">
    Liên kết website
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageContent" runat="Server">
    <asp:Label ID="lblPermissionMessage" runat="server" Font-Bold="true" ForeColor="Red"
        Text="Tài khoản không có quyền truy cập vào trang này" Visible="false"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Visible="true">
        <div style="text-align: center; margin-top: 10px; margin-bottom: 10px;">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" Font-Bold="true" DisplayMode="List"
                ValidationGroup="Weblink" />
            <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
        </div>
        <div style="width: 100%; margin-bottom: 10px">
            <asp:GridView ID="grvWeblink" runat="server" AutoGenerateColumns="False" GridLines="None"
                Width="100%" AllowPaging="True" PageSize="10" CssClass="grid" OnPageIndexChanging="grvWeblink_PageIndexChanging">
                <Columns>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Website" ItemStyle-HorizontalAlign="left">
                        <ItemTemplate>
                            <%# Eval("Name") %>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="400" HeaderText="Url"
                        ItemStyle-HorizontalAlign="left" ItemStyle-Width="400">
                        <ItemTemplate>
                            <%# Eval("Url") %>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="400"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Thứ tự" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Eval("Index") %>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" Width="80px"></ItemStyle>
                        <HeaderStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="40px"
                        ItemStyle-HorizontalAlign="Center" ItemStyle-Width="40px">
                        <ItemTemplate>
                            <asp:ImageButton ID="imbWeblinkEdit" runat="server" ImageUrl="~/WebmasterTool/Images/Edit.gif"
                                CommandArgument='<%# Eval("ID") %>' OnCommand="imbWeblinkEdit_Command"></asp:ImageButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="40px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center" Width="40px"></ItemStyle>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    <table align="center" bgcolor="#ffffcc" border="0" width="100%">
                        <tr>
                            <td align="center" height="50">
                                <div id="EmptyData" align="center">
                                    Chưa có dữ liệu.</div>
                            </td>
                        </tr>
                    </table>
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
        <div style="border: solid 1px #ccc; float: left; background: #f4f4f4; width: 100%">
            <center>
                <table cellpadding="2" cellspacing="0" border="0" width="600" style="margin-top: 10px;
                    margin-bottom: 10px;">
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                            Tên website:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtWeblinkName" runat="server" Width="250px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtWeblinkName"
                                ErrorMessage="Chưa nhập tên weblink" Display="Dynamic" ValidationGroup="Weblink">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                            Tên website(en):
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtWeblinkName_en" runat="server" Width="250px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                            Url:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtWeblinkUrl" runat="server" Width="250px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtWeblinkUrl"
                                ErrorMessage="Chưa nhập url weblink" Display="Dynamic" ValidationGroup="Weblink">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Sai định dạng url"
                                ControlToValidate="txtWeblinkUrl" ValidationExpression="(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?"
                                Display="Dynamic" ValidationGroup="Weblink">*
                            </asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                            Vị trí:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtWeblinkIndex" runat="server" Width="250px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Chưa nhập vị trí weblink"
                                ControlToValidate="txtWeblinkIndex" ValidationGroup="Weblink" Display="Dynamic">*</asp:RequiredFieldValidator>
                            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Vị trí weblink phải là số từ 0 đến 9999"
                                ControlToValidate="txtWeblinkIndex" ValidationGroup="Weblink" Display="Dynamic"
                                MinimumValue="0" MaximumValue="9999" Type="Integer">*</asp:RangeValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                            Ảnh:
                        </td>
                        <td align="left">
                            <uc1:SimpleImageUpload ID="siuWeblinkImage" runat="server" CssClass="ImageUpload"
                                AutoOpenImageEditPopupAfterUpload="true" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                            Thuộc tính alt ảnh:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtWeblinkAlt" runat="server" Width="250px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 120px; color: #555">
                        </td>
                        <td align="left">
                            <asp:Button ID="btnSave" runat="server" Text="Lưu" Width="80px" Style="margin-right: 2px;"
                                CommandName="Insert" ValidationGroup="Weblink" OnClick="btnSave_Click" />
                            <asp:Button ID="btnNew" runat="server" Text="Thêm mới" Width="80px" Style="margin-right: 2px"
                                Visible="false" OnClick="btnNew_Click" />
                            <asp:Button ID="btnDelete" runat="server" Text="Xoá" Width="80px" Visible="false"
                                OnClick="btnDelete_Click" />
                        </td>
                    </tr>
                </table>
            </center>
        </div>
    </asp:Panel>
</asp:Content>
